#!/usr/bin/python
# -*- coding: utf-8 -*-

from twisted.internet import reactor
from twisted.internet.serialport import SerialPort
from twisted.internet.protocol import Protocol, Factory


class WebLog(Protocol):
    def connectionMade(self):
        print "Connected from"#, self.transport.client
        #self.transport.write('<hits>')
    def dataReceived(self, data):
        print data
        #self.transport.write(data)
        
    def connectionLost(self, reason):
        print "Disconnected from"#, self.transport.client


SerialPort(WebLog(), "/dev/ttyUSB1", reactor, baudrate=9600)
reactor.run()
